package de.szut.Pong.GUI;

import java.awt.Container;

import javax.swing.JFrame;
import javax.swing.JMenuBar;

public class Frame extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3699383660884961597L;

	public Frame(Field field, JMenuBar menu) throws InterruptedException {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setJMenuBar(menu);
		setBounds(100, 100, 800, 850);
		setResizable(false);
		setVisible(true);
		setContentPane((Container) field);

		Thread.sleep(2000);

		field.moveBall(new Point(5, 5));
		field.showMoves();

		Thread.sleep(2000);

		field.incrementLeftCounter();
		field.respawn(new Point(32, 29));

		Thread.sleep(2000);

		for (int i = 0; i < 20; i++) {
			field.moveLeftPad(PadMovement.DOWN);
		}
		field.showMoves();

		Thread.sleep(2000);

		field.incrementRightCounter();
		field.respawn(new Point(32, 29));

		Thread.sleep(2000);

		for (int i = 0; i < 20; i++) {
			field.moveRightPad(PadMovement.UP);
		}
		field.showMoves();

		Thread.sleep(2000);

		field.reset();
		Thread.sleep(2000);
		field.displayVictoryLeft();
		Thread.sleep(2000);
		field.displayHalfTime();
		Thread.sleep(2000);
		field.needUsersError();
		Thread.sleep(2000);
		field.displayVictoryRight();
		Thread.sleep(2000);
		field.reset();

	}
}
